home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Patches.p < prev    next >
Text File  |  1996-05-01  |  7KB  |  231 lines

  1. {
  2.      File:        Patches.p
  3.  
  4.      Contains:    Patch Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Patches;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __PATCHES__}
  28. {$SETC __PATCHES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC PatchesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __KERNEL__}
  38. {$I Kernel.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __ORDEREDITEMS__}
  41. {$I OrderedItems.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
  49.  
  50. CONST
  51.     kOSTrapType                    = 0;
  52.     kToolboxTrapType            = 1;
  53.  
  54.  
  55. TYPE
  56.     TrapType                            = SignedByte;
  57.  
  58. CONST
  59.     OSTrap                        = 0;                            {  old name  }
  60.     ToolTrap                    = 1;                            {  old name  }
  61.  
  62. {
  63.     GetTrapAddress and SetTrapAddress are obsolete and should not
  64.     be used. Always use NGetTrapAddress and NSetTrapAddress instead.
  65.     The old routines will not be supported for PowerPC apps.
  66. }
  67. {$IFC OLDROUTINENAMES AND NOT GENERATINGCFM }
  68. FUNCTION GetTrapAddress(trapNum: UInt16): UniversalProcPtr;
  69.     {$IFC NOT GENERATINGCFM}
  70.     INLINE $301F, $A146, $2E88;
  71.     {$ENDC}
  72. PROCEDURE SetTrapAddress(trapAddr: UniversalProcPtr; trapNum: UInt16);
  73.     {$IFC NOT GENERATINGCFM}
  74.     INLINE $301F, $205F, $A047;
  75.     {$ENDC}
  76. {$ENDC}
  77. FUNCTION NGetTrapAddress(trapNum: UInt16; tTyp: TrapType): UniversalProcPtr;
  78. PROCEDURE NSetTrapAddress(trapAddr: UniversalProcPtr; trapNum: UInt16; tTyp: TrapType);
  79. FUNCTION GetOSTrapAddress(trapNum: UInt16): UniversalProcPtr;
  80.     {$IFC NOT GENERATINGCFM}
  81.     INLINE $301F, $A346, $2E88;
  82.     {$ENDC}
  83. PROCEDURE SetOSTrapAddress(trapAddr: UniversalProcPtr; trapNum: UInt16);
  84.     {$IFC NOT GENERATINGCFM}
  85.     INLINE $301F, $205F, $A247;
  86.     {$ENDC}
  87. FUNCTION GetToolTrapAddress(trapNum: UInt16): UniversalProcPtr;
  88.     {$IFC NOT GENERATINGCFM}
  89.     INLINE $301F, $A746, $2E88;
  90.     {$ENDC}
  91. PROCEDURE SetToolTrapAddress(trapAddr: UniversalProcPtr; trapNum: UInt16);
  92.     {$IFC NOT GENERATINGCFM}
  93.     INLINE $301F, $205F, $A647;
  94.     {$ENDC}
  95. FUNCTION GetToolboxTrapAddress(trapNum: UInt16): UniversalProcPtr;
  96.     {$IFC NOT GENERATINGCFM}
  97.     INLINE $301F, $A746, $2E88;
  98.     {$ENDC}
  99. PROCEDURE SetToolboxTrapAddress(trapAddr: UniversalProcPtr; trapNum: UInt16);
  100.     {$IFC NOT GENERATINGCFM}
  101.     INLINE $301F, $205F, $A647;
  102.     {$ENDC}
  103. {
  104.  
  105. // Moved here from StdCLib
  106. pascal Boolean TrapAvailable (UInt16 trapNumber);
  107.  
  108. }
  109. {$ENDC}
  110. {  FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
  111. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  112.  
  113. TYPE
  114.     PatchID = ^LONGINT;
  115.     PatchChainID = ^LONGINT;
  116.     PatchableProcPtr                    = Ptr;
  117.     PatchOptions                        = OptionBits;
  118.  
  119. CONST
  120.     kPatchEnabledBit            = 0;
  121.     kPatchCompatibilityBit        = 1;
  122.     kPatchOptionalBit            = 2;
  123.  
  124.     kPatchEnabledMask            = $00000001;
  125.     kPatchCompatibilityMask        = $00000002;
  126.     kPatchOptionalMask            = $00000004;
  127.  
  128.  
  129. TYPE
  130.     PatchName                            = OrderedItemName;
  131.     PatchNamePtr                         = ^PatchName;
  132.     PatchOrderRequirements                = OrderRequirements;
  133.     PatchOrderRequirementsPtr             = ^PatchOrderRequirements;
  134.     PatchDescriptionPtr = ^PatchDescription;
  135.     PatchDescription = RECORD
  136.         originalRoutine:        PatchableProcPtr;                        {  A normal (probably imported) proc ptr. }
  137.         patchRoutine:            PatchableProcPtr;                        {  A normal (probably imported) proc ptr. }
  138.         thisPatchName:            PatchName;
  139.         thisPatchOrdering:        PatchOrderRequirements;
  140.         installOptions:            PatchOptions;
  141.         installResult:            OSStatus;
  142.         thisPatchID:            PatchID;                                {  Set if installed OK. }
  143.         thisCallThroughProc:    PatchableProcPtr;                        {  Set if installed OK. }
  144.         rejectingPatchID:        PatchID;                                {  Set if there was an installation error. }
  145.     END;
  146.  
  147.     PatchDescriptionPtrPtr                = ^PatchDescriptionPtr;
  148.     PatchHeaderOptions                    = OptionBits;
  149.  
  150. CONST
  151.     kRequiredPatchErrorsMask    = $00000001;                    {  Any installation errors in required patches? }
  152.     kOptionalPatchErrorsMask    = $00000002;                    {  Any installation errors in optional patches? }
  153.  
  154.     kPatchHeaderTag                = 'Ptch';
  155.     kPatchHeaderVersion            = 1;
  156.  
  157.  
  158. TYPE
  159.     PatchHeaderPtr = ^PatchHeader;
  160.     PatchHeader = RECORD
  161.         tag:                    OSType;                                    {  Must be 'Ptch'. }
  162.         version:                UInt32;                                    {  The data structure version. }
  163.         flags:                    PatchHeaderOptions;                        {  Set by CFM with install status. }
  164.         count:                    ItemCount;                                {  The total size of the "patches" array. }
  165.         patches:                ^PatchDescriptionPtr;                    {  Pointer to description array. }
  166.     END;
  167.  
  168.  
  169. CONST
  170.     kPatchInformationVersion    = 1;
  171.  
  172.  
  173. TYPE
  174.     PatchInformationPtr = ^PatchInformation;
  175.     PatchInformation = RECORD
  176.         patchChain:                PatchChainID;
  177.         patchingRoutine:        PatchableProcPtr;
  178.         patchOptions:            PatchOptions;
  179.         patchName:                PatchName;
  180.         patchOrder:                PatchOrderRequirements;
  181.     END;
  182.  
  183.  
  184. CONST
  185.     kPatchChainInformationVersion = 1;
  186.  
  187.  
  188. TYPE
  189.     PatchChainInformationPtr = ^PatchChainInformation;
  190.     PatchChainInformation = RECORD
  191.         kernelProcess:            KernelProcessID;
  192.         chainRoot:                PatchableProcPtr;
  193.     END;
  194.  
  195. {
  196.  *    Maps a ProcPtr to a PatchChainID.
  197.  *        If the ProcPtr is a patch,                     return noErr and Chain
  198.  *        If the ProcPtr is a root,                     return noErr and Chain 
  199.  *        If the ProcPtr is not a patch or a root,     return an error
  200. }
  201. FUNCTION GetPatchChainFromProcPtr(theKernelProcess: KernelProcessID; theRoutine: PatchableProcPtr; VAR thePatchChain: PatchChainID): OSStatus; C;
  202. {
  203.  *    Maps a ProcPtr to a PatchID.
  204.  *        If the ProcPtr is a patch,                     return noErr and the PatchID
  205.  *        If the ProcPtr is a root,                     return notAPatchErr
  206.  *        If the ProcPtr is not a patch or a root,     return notAPatchErr
  207. }
  208. FUNCTION GetPatchFromProcPtr(theKernelProcess: KernelProcessID; theRoutine: PatchableProcPtr; VAR thePatch: PatchID): OSStatus; C;
  209. FUNCTION GetPatchChainInformation(thePatchChain: PatchChainID; version: PBVersion; VAR patchChainInfo: PatchChainInformation): OSStatus; C;
  210. FUNCTION GetPatchInformation(thePatchID: PatchID; version: PBVersion; VAR patchInfo: PatchInformation): OSStatus; C;
  211. {
  212.  *    Iteration functions:
  213.  *        Get all the chains in a KernelProcess, and
  214.  *        Get all the patches in a chain
  215. }
  216. FUNCTION GetPatchChainsInKernelProcess(theKernelProcess: KernelProcessID; requestedPatchChains: ItemCount; VAR totalPatchChains: ItemCount; VAR thePatchChains: PatchChainID): OSStatus; C;
  217. FUNCTION GetPatchesInPatchChain(thePatchChain: PatchChainID; requestedPatches: ItemCount; VAR totalPatches: ItemCount; VAR thePatches: PatchID): OSStatus; C;
  218. FUNCTION EnablePatch(thePatch: PatchID): OSStatus; C;
  219. FUNCTION DisablePatch(thePatch: PatchID): OSStatus; C;
  220. {$ENDC}
  221. {$ALIGN RESET}
  222. {$POP}
  223.  
  224. {$SETC UsingIncludes := PatchesIncludes}
  225.  
  226. {$ENDC} {__PATCHES__}
  227.  
  228. {$IFC NOT UsingIncludes}
  229.  END.
  230. {$ENDC}
  231.